<template>
  <div class="app">
    <router-view />
  </div>
</template>


<script lang='ts'>
import { defineComponent } from 'vue'
import axios from "axios";
import store from "@/store";
export default defineComponent({
  setup() {

    //原始的Axios请求方式
    /**
     axios({
      method: 'post',
      url: 'http://192.168.31.137:8088/login',
      data: qs.stringify({
        username: 'admin',
        password: '96e79218965eb72c92a549dd5a330112'
      }),
      timeout: 3000
    })
     **/


    if(process.env.NODE_ENV == 'production') {
      //在生产环境中的 production
      axios.get('/config.json').then((res)=>{
        sessionStorage.setItem('nodesServer',res.data.nodesServer)
        sessionStorage.setItem('nidtgaServer',res.data.nidtgaServer)
        store.state.nodesServer=res.data.nodesServer
        store.state.nidtgaServer=res.data.nidtgaServer
      })
    }else if(process.env.NODE_ENV == 'development') {
      //在开发环境中的 development
      const config = require("../public/config.json");
      store.state.nodesServer=config.nodesServer
      store.state.nidtgaServer=config.nidtgaServer
    }else{
      store.state.nodesServer = sessionStorage.getItem('nodesServer')
      store.state.nidtgaServer = sessionStorage.getItem('nidtgaServer')
    }


    return
  }
})
</script>

<style lang="scss" scoped>
.app {
  width: 100vw;
  height: 100vh;
  background-color: #020308;
  overflow: hidden;
}
</style>
